package com.sc.VenusQueryBeta.model.account.cundan;

import com.hengjun.kingstar.sdk.base.BaseModel;
import com.hengjun.kingstar.sdk.helper.RetrofitCreateHelper;
import com.hengjun.kingstar.sdk.helper.RxHelper;
import com.sc.VenusQueryBeta.api.Host;
import com.sc.VenusQueryBeta.api.account.AccountApi;
import com.sc.VenusQueryBeta.contract.account.cundan.CunDanContract;
import com.sc.VenusQueryBeta.model.bean.account.CunDanBean;
import com.sc.VenusQueryBeta.model.bean.account.CurrencyListBean;

import io.reactivex.Observable;

/**
 * Created by SC-02 on 2018/9/19.
 * 存單明细model 继承Basemodel 并且实现契约累的model方法
 */

public class CunDanModel extends BaseModel implements CunDanContract.ICunDanModel {
    /**
     * 實例化對象
     */
    public static CunDanModel newInstance(){
        return new CunDanModel();
    }

    @Override
    public Observable<CunDanBean> cundan(int clientindex, String serverAddress, String projectName, int serverPort,String currencynameCN) {
        return RetrofitCreateHelper.createApi(AccountApi.class, Host.base+serverAddress+":"+serverPort+"/"+projectName+"/").
                cundan(clientindex,currencynameCN).compose(RxHelper.<CunDanBean>rxSchedulerHelper());
    }

    @Override
    public Observable<CurrencyListBean> queryAllCurrencyList(String serverAddress, String projectName, int serverPort) {
        return RetrofitCreateHelper.createApi(AccountApi.class, Host.base+serverAddress+":"+serverPort+"/"+projectName+"/").queryCurrencyList().compose(RxHelper.<CurrencyListBean>rxSchedulerHelper());
    }
}
